import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('@/views/layout/HomeView.vue')
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('@/views/layout/ShouSuo.vue')
  },
  {
    path: '/product',
    name: 'productDetail',
    component: () => import('@/views/layout/ProductDetail.vue')
  },
  {
    path: '/cart',
    name: 'cart',
    component: () => import('@/views/layout/GouWu.vue')
  },
  {
    path: '/mine',
    name: 'mine',
    component: () => import('@/views/layout/MineView.vue')
  },
  {
    path: '/settings',
    name: 'settings',
    component: () => import('@/views/layout/SettingsView.vue')
  },
  {
    path: '/personal-info',
    name: 'personalInfo',
    component: () => import('@/views/layout/PersonalInfoView.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/layout/LoginView.vue')
  },
  {
    path: '/address',
    name: 'address',
    component: () => import('@/views/layout/AddressManageView.vue'),
    alias: '/address-manage'
  },
  {
    path: '/address/form',
    name: 'addressForm',
    component: () => import('@/views/layout/AddressFormView.vue')
  },
  {
    path: '/security',
    name: 'security',
    component: () => import('@/views/layout/SecurityView.vue')
  },
  {
    path: '/change-password',
    name: 'changePassword',
    component: () => import('@/views/layout/ChangePasswordView.vue')
  },
  {
    path: '/forget-password',
    name: 'forgetPassword',
    component: () => import('@/views/layout/ForgetPasswordView.vue')
  },
  {
    path: '/phone-management',
    name: 'phoneManagement',
    component: () => import('@/views/layout/PhoneManagementView.vue')
  },
  {
    path: '/security-center',
    name: 'securityCenter',
    component: () => import('@/views/layout/SecurityCenterView.vue')
  },
  {
    path: '/security-questions',
    name: 'securityQuestions',
    component: () => import('@/views/layout/SecurityQuestionsView.vue')
  },
  {
    path: '/verification',
    name: 'verification',
    component: () => import('@/views/layout/verification.vue')
  },
  {
    path: '/member-code',
    name: 'memberCode',
    component: () => import('@/views/layout/MemberCodeView.vue')
  },
  {
    path: '/order-confirm',
    name: 'orderConfirm',
    component: () => import('@/views/layout/OrderConfirmView.vue')
  },
  {
    path: '/payment',
    name: 'payment',
    component: () => import('@/views/layout/PaymentView.vue')
  },
  {
    path: '/my-orders',
    name: 'myOrders',
    component: () => import('@/views/layout/MyOrdersView.vue')
  },
  {
    path: '/service',
    name: 'service',
    component: () => import('@/views/layout/CustomerServiceView.vue')
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
